/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.kreig133.analytic.builder;

import com.kreig133.analytic.interfaces.DataMiner;
import com.kreig133.analytic.interfaces.ViewDataHandler;
import com.kreig133.builder.AbstractDirector;
import com.kreig133.xml.XmlParser;
import java.io.File;

/**
 *
 * @author C.C.-fag
 */
public class AnalyticBuildDirector extends AbstractDirector<DataMiner, ViewDataHandler> {

    public AnalyticBuildDirector(DataMiner base, Object parametrs) {
        super(base, parametrs);
    }

    @Override
    public ViewDataHandler construct() {
        switch (type) {
            case XML:
                XmlParser parser = XmlParser.createXmlParser(XmlParser.ANALYTIC);
                parser.parseXML((File) parametrs);
                AnalyticBuilder analyticBuilder = new AnalyticBuilder();
                analyticBuilder.setDataMiner(base);
                analyticBuilder.setParametrsForBuild(parser.getParametrsForBuild());
                analyticBuilder.createHandlers();
                return analyticBuilder.getAnalyticChain();

        }
        return null;
    }
}
